import { FormInstance } from 'antd';
import { FormValue, EditType } from '../types';

export function getEditTypes(form: FormInstance<FormValue>) {
  const editTypes: EditType[] = [];
  form.isFieldsTouched([
    ['plank', 'size'],
    ['plank', 'points'],
  ]) && editTypes.push(EditType.Plank);
  form.isFieldsTouched([['plank', 'holes']]) && editTypes.push(EditType.Hole);
  form.isFieldsTouched([['plank', 'groupedGroove']]) &&
    editTypes.push(EditType.Groove);
  return editTypes;
}
